<?php
	header("Content-Type: application/vnd.ms-excel");
	header("Content-Disposition: attachment; filename=\"statistiques.xls\"");
?>

<table>
	<caption>Meilleures ventes</caption>
	<tr>
		<th>Nom produit</th>
		<th>Quantite vendue</th>
	</tr>
	<?php
		foreach($bv as $key => $val){
			echo "<tr>";
			echo "<td>" . $key . "</td>";
			echo "<td>" . $val . "</td>";
			echo "</tr>";
		}
	?>
</table>

<table></table>
<table></table>
<table></table>

<table>
	<caption>Ventes par categorie</caption>
	<tr>
		<th>Nom categorie</th>
		<th>Quantite vendue</th>
	</tr>
	<?php
		foreach($vc as $v){
			echo "<tr>";
			echo "<td>" . $v['nom'] . "</td>";
			echo "<td>" . $v['ventes'] . "</td>";
			echo "</tr>";
		}
	?>
</table>

<table></table>
<table></table>
<table></table>

<table>
	<caption>Ventes par pays</caption>
	<tr>
		<th>Nom pays</th>
		<th>Quantite vendue</th>
	</tr>
	<?php
		foreach($vp as $key => $val){
			echo "<tr>";
			echo "<td>" . $key . "</td>";
			echo "<td>" . $val . "</td>";
			echo "</tr>";
		}
	?>
</table>

<table></table>
<table></table>
<table></table>

<table>
	<caption>Nombre de produit par categorie</caption>
	<tr>
		<th>Nom categorie</th>
		<th>Nombre de produit</th>
	</tr>
	<?php
		foreach($pc as $p){
			echo "<tr>";
			echo "<td>" . $p['nom'] . "</td>";
			echo "<td>" . $p['nbr'] . "</td>";
			echo "</tr>";
		}
	?>
</table>

<table></table>
<table></table>
<table></table>

<table>
	<caption>Moyenne d'age des acheteurs par categorie</caption>
	<tr>
		<th>Nom categorie</th>
		<th>Moyenne d'age</th>
	</tr>
	<?php
		foreach($ac as $a){
			echo "<tr>";
			echo "<td>" . $a['nom'] . "</td>";
			echo "<td>" . $a['moyenne'] . "</td>";
			echo "</tr>";
		}
	?>
</table>

<table></table>
<table></table>
<table></table>

